import Admonition from "@theme/Admonition";
import CodeBlock from "@theme/CodeBlock";

import ComponentConfiguration from "@site/src/pages/components-explorer/_components/ComponentConfiguration";
import ComponentHeader from "@site/src/pages/components-explorer/_components/ComponentHeader";
import ComponentTroubleshooting from "@site/src/pages/components-explorer/_components/ComponentTroubleshooting/index.mdx";
import FaceRecognition from "@site/src/pages/components-explorer/_domains/face_recognition/index.mdx";
import LicensePlateRecognition from "@site/src/pages/components-explorer/_domains/license_plate_recognition/index.mdx";
import ObjectDetector from "@site/src/pages/components-explorer/_domains/object_detector/index.mdx";

import ComponentMetadata from "./_meta";
import config from "./config.json";

<ComponentHeader meta={ComponentMetadata} />

CodeProject.AI Server is a self-hosted, free and Open Source Artificial Intelligence Server for any platform, any language. Just like you would install a database server to provide data storage, you install CodeProject.AI Server to provide AI services.

It can be installed locally, requires no off-device or out of network data transfer, and is easy to use.

Head over to the [CodeProject.AI Documentation](https://www.codeproject.com/AI/docs/) for installation instructions.

## Configuration

<details>
  <summary>Configuration example</summary>

```yaml title="/config/config.yaml"
codeprojectai:
  host: codeprojectai
  port: 32168
  object_detector:
    cameras:
      viseron_CHANGEME_camera:
        fps: 1
        log_all_objects: true
        labels:
          - label: person
            confidence: 0.8
            trigger_event_recording: true
          - label: cat
            confidence: 0.8
        zones:
          - name: zone1
            coordinates:
              - x: 0
                y: 500
              - x: 1920
                y: 500
              - x: 1920
                y: 1080
              - x: 0
                y: 1080
            labels:
              - label: person
                confidence: 0.8
                trigger_event_recording: true
        mask:
          - coordinates:
              - x: 400
                y: 200
              - x: 1000
                y: 200
              - x: 1000
                y: 750
              - x: 400
                y: 750
      camera_two:
        fps: 1
        labels:
          - label: person
            confidence: 0.7
            trigger_event_recording: true
          - label: cat
            confidence: 0.8
            trigger_event_recording: false
  face_recognition:
    save_unknown_faces: true
    cameras:
      camera_two:
    labels:
      - person
  license_plate_recognition:
    cameras:
      camera_one:
    labels:
      - vehicle
      - car
      - truck
    known_plates:
      - ABC123
```

</details>

<ComponentConfiguration config={config} />

<FaceRecognition />

<LicensePlateRecognition />

<ObjectDetector
  meta={ComponentMetadata}
  showLabels={false}
  extras={
    <Admonition type="tip">
      The available labels depend on the detection model used. At the time of writing, the default model includes the following labels:
      <CodeBlock language="bash">
        person, vehicle, plus objects in ipcam-dark
      </CodeBlock>

      At the time of writing, the custom models available are:
      <table>
        <thead>
          <tr>
            <th>Model</th>
            <th>Labels</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>ipcam-animal</td>
            <td>bird, cat, dog, horse, sheep, cow, bear, deer, rabbit, raccoon, fox, skunk, squirrel, pig</td>
          </tr>
          <tr>
            <td>ipcam-dark</td>
            <td>Bicycle, Bus, Car, Cat, Dog, Motorcycle, Person</td>
          </tr>
          <tr>
            <td>ipcam-general</td>
            <td>person, vehicle, plus objects in ipcam-dark</td>
          </tr>
          <tr>
            <td>ipcam-combined</td>
            <td>person, bicycle, car, motorcycle, bus, truck, bird, cat, dog, horse, sheep, cow, bear, deer, rabbit, raccoon, fox, skunk, squirrel, pig</td>
          </tr>
        </tbody>
      </table>
    </Admonition>

}

/>

<ComponentTroubleshooting meta={ComponentMetadata} />
